<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:head>
    <link rel="shortcut icon" type="image/png" href="#{request.contextPath}/resources/images/favicon.ico"/>
    <link type="text/css" rel="stylesheet"
		href="#{request.contextPath}/resources/css/styles.css" />
    <title>Notification Center</title>
</h:head> 
<h:body>
<div id="wrap">
        <div id="header">
			<ui:include src="/CommonHeader.xhtml"></ui:include>
		</div>
	
            <div id="inner-wrap">
			<div id="content">
	<br />
	<h:form id="notifyManager">	
            
		<h:panelGrid>
			<p:dataTable id="invitesTab" var="invite"
                                     value="#{notificationsBean.invitesList}"
				paginator="true" rows="10" lazy="true"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20">
                                    <f:facet name="header">Invitations</f:facet>
                                    <p:column><f:facet name="header">Title</f:facet>#{invite.event.title} </p:column>
                                    <p:column><f:facet name="header">Date Time Start</f:facet>#{invite.event.dateTimeStart} </p:column>
                                    <p:column><f:facet name="header">Date Time End</f:facet>#{invite.event.dateTimeEnd} </p:column>
                                    <p:column><f:facet name="header">Status</f:facet>#{invite.getStringState()} </p:column>
                                    <p:column>
                                        <p:commandButton id="acceptInvite" value="Accept"
                                                         action="#{notificationsBean.acceptInvite(invite)}" 
                                                         update="invitesTab"
                                                         rendered="#{invite.acceptButtonVisible()}"
						/>
                                    </p:column>   
                                    <p:column>
                                        <p:commandButton id="declineInvite" value="Decline"
                                                         action="#{notificationsBean.declineInvite(invite)}" 
                                                         update="invitesTab"
                                                         rendered="#{invite.declineButtonVisible()}"
						/>
                                    </p:column> 
                                    <p:column>
                                        <p:commandButton id="eventadd" value="Show"
                                                         action="#{notificationsBean.goToEditEvent(invite.event)}" ajax="false"
						/>
                                    </p:column> 
                             </p:dataTable>
			</h:panelGrid>
            <p:messages id="msgInvite" showDetail="true" autoUpdate="true" closable="true" />     
            <br/><br/>
            <h:panelGrid>
			<p:dataTable id="badeventTab" var="event"
                                     value="#{notificationsBean.badeventList}"
				paginator="true" rows="10" lazy="true"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20">
                                    <f:facet name="header">Bad Weather Forecast Events</f:facet>
                                    <p:column><f:facet name="header">Title</f:facet>#{event.title} </p:column>
                                    <p:column><f:facet name="header">Date Time Start</f:facet>#{event.dateTimeStart} </p:column>
                                    <p:column><f:facet name="header">Date Time End</f:facet>#{event.dateTimeEnd} </p:column>
                                    <p:column style="text-align: center"><f:facet name="header">Weather</f:facet><img src="#{event.idWeather.getWeatherIconURL()}" 
                                            alt="Weather ICON" style="height: 50px;"/> #{event.idWeather.weatherDesc}  </p:column>                                 
                                    <p:column>
                                        <p:commandButton id="eventadd" value="Show"
                                                         action="#{notificationsBean.goToEditEvent(event)}" ajax="false"
						/>
                                    </p:column>  
                             </p:dataTable>
			</h:panelGrid>
            <p:messages id="msgBadWeather" showDetail="true" autoUpdate="true" closable="true" />  
	</h:form>

              </div>
        </div>
     </div> 
</h:body>
</html>

